<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
     <%@ include file="common.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<script type="text/javascript">
	$(document).ready(function() {
		$("#itemName").focus();
		$("#itemTransaction").attr("action",'<c:url value="/saveTransaction.htm"></c:url>');
		createItemAutocomplete('itemAutocomplete');
		});
	</script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<form:form commandName="itemTransactionDTO" id="itemTransaction">
	<table class="mainTable">
		<tr>
			<td>
				<form:label path="itemName">Select Item</form:label>
			</td>
			<td>
				<form:input path="itemName" id="itemAutocomplete" cssClass="text ui-widget-content ui-corner-all"/>
				<form:errors path="itemName"></form:errors>
			</td>
		</tr>
		<tr>
			<td>
				<form:label path="opertionType">Operation Type</form:label>
			</td>
			<td>
				<form:radiobutton path="opertionType" onchange="checkOperation()" name="opertionType" value="Sale"/>&nbsp; Sale&nbsp;
				<form:radiobutton path="opertionType" onchange="checkOperation()" name="opertionType" value="Purchase"/>&nbsp;Purchase&nbsp;
				<form:radiobutton path="opertionType" onchange="checkOperation()" name="opertionType" value="Broken"/>&nbsp;Broken&nbsp;
				<form:radiobutton path="opertionType" onchange="checkOperation()" name="opertionType" value="Lost"/>&nbsp;Lost&nbsp;
				<form:radiobutton path="opertionType" onchange="checkOperation()" name="opertionType" value="Return"/>&nbsp;Return&nbsp;
			</td>
		</tr>
		<tr>
			<td>
				<form:label path="quantity" >Quantity of Item</form:label>
			</td>
			<td>
				<form:input path="quantity" id="itemCount" cssClass="ui-corner-all"/>
				<form:errors path="quantity"></form:errors>
				<form:label path="quantity" id="availableStock"></form:label>
			</td>
		</tr>
		<tr>
			<td>
				<form:label path="price">Price of Item</form:label>
			</td>
			<td>
				<form:input path="price" cssClass="ui-corner-all"/>
			</td>
		</tr>		
		<tr>
			<td>
				<input type="button" value="Save Transaction" onclick="saveEntity('itemTransaction')">
			</td>
		</tr>
	</table>

</form:form>
</body>
</html>